package com.myblog.myblog.interceptor;
/**
 * 拦截器
 */

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration  //配置类
public class ControllerConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())  //过滤
                .addPathPatterns("/admin/**")  //排除
                .excludePathPatterns("/admin")  //可以通过
                .excludePathPatterns("/admin/login");
    }
}
